package com.fun.feifun.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.net.InetAddress;

@Component
public class ApplicationRunnerImpl implements ApplicationRunner {

    @Value("${api}")
    String host;
    @Value("${server.port}")
    String port;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        String  ip = InetAddress.getLocalHost().getHostAddress();
        System.out.println("接口文档地址:http:/"+ip+":"+port+"/doc.html#/");
        System.out.println("接口文档地址:http:/"+host+"/doc.html#/");
        String[] sourceArgs = args.getSourceArgs();
        for (String arg : sourceArgs) {
            System.out.print(arg + " ");
        }
    }
}
